* Pro Trade, Against Competition: Explaining Firms' Support for Selective Trade Protection*

************************* Table 4.1 & 4.3 ********************************************

use "STP Dataset(V2).dta", clear

drop if Year == 2007
gen TradeBarrier = 1 if TradeBarrierCount>0
replace TradeBarrier = 0 if TradeBarrierCount==0
gen Trade_importance = ((ImportT1+ExportT1)/(ImportCountryT1+ExportCountryT1))*100
gen Import_log = ln(ImportT1)
gen Export_log = ln(Export)
drop if ImportincreaseT1T2 ==.
gen importincrease = 1 if ImportincreaseT1T2>=0
replace importincrease = 0 if ImportincreaseT1T2<0
gen importsurge75 = 1 if ImportincreaseT1T2>=75
replace importsurge75 = 0 if ImportincreaseT1T2<75
gen importsurge45 = 1 if ImportincreaseT1T2>=45
replace importsurge45 = 0 if ImportincreaseT1T2<45
gen HomRaw = 1 if RawMaterials==1 & Rauchcon==0
replace HomRaw=0 if RawMaterials==0 | Rauchcon==1

corr IITt1 GVC importsurge45 importsurge75 PTAs importincrease TariffAHSWAAll Trade_importance HomRaw 

sum TradeBarrier SelectiveProtection IITt1 IntrafirmT1 importsurge45 importsurge75 Government PTAs importincrease TariffAHSWAAll Trade_importance

corr IITt1 Rauchcon

heckprobit SelectiveProtection IITt1 GVC i.Countryid i.Sector, sel(TradeBarrier= importincrease i.Countryid i.Sector) vce(robust) first

drop if TariffAHSWAAll==.

heckprobit SelectiveProtection IITt1 GVC importsurge45 ib3.Government PTAs i.Countryid i.Sector, sel(TradeBarrier= importincrease ib3.Government TariffAHSWAAll Trade_importance i.Countryid i.Sector) vce(robust) first

margins , predict(pcon) at(IITt1 = (0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 0.95 1)) post coeflegend atmeans level(97.5)
lincom _b[19bn._at] - _b[5bn._at]
marginsplot, recast(line) recastci(rarea) ytitle(Prob (STP=1)) legend(off) graphr(c(gs16)) xlabel(0(0.2)1) title("")

heckprobit SelectiveProtection IITt1 GVC importsurge45 ib3.Government PTAs i.Countryid i.Sector, sel(TradeBarrier= importincrease ib3.Government TariffAHSWAAll Trade_importance i.Countryid i.Sector) vce(robust) first

margins , predict(pcon) at(GVC = (0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 0.95 1)) post coeflegend atmeans level(97.5)
lincom _b[21bn._at] - _b[1bn._at]
marginsplot, recast(line) recastci(rarea) ytitle(Prob (STP=1)) legend(off) graphr(c(gs16)) xlabel(0(0.2)1) title("")

drop if Rauchcon==.

heckprobit SelectiveProtection IITt1 GVC  importsurge75 ib3.Government PTAs  i.Countryid i.Sector, sel(TradeBarrier=  importincrease IITt1 GVC ib3.Government TariffAHSWAAll Trade_importance HomRaw i.Countryid i.Sector) vce(robust) first

keep if Countryid==8

heckprobit SelectiveProtection IITt1 IntrafirmT1 importsurge45 ib3.Government PTAs i.Sector, sel(TradeBarrier=  importincrease IITt1 GVC ib3.Government TariffAHSWAAll Trade_importance HomRaw i.Sector) vce(robust) first 

margins , predict(pcon) at(IntrafirmT1 = (0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 0.95 1)) post coeflegend atmeans level(97.5) noestimcheck
lincom _b[17bn._at] - _b[5bn._at]
marginsplot, recast(line) recastci(rarea) ytitle(Prob (STP=1)) legend(off) xlabel(0(0.2)1) title("")

************************* Table 4.4 ***********************************
use "STP Dataset(V2).dta", clear

drop if Year == 2007
gen TradeBarrier = 1 if TradeBarrierCount>0
replace TradeBarrier = 0 if TradeBarrierCount==0
gen Trade_importance = ((ImportT1+ExportT1)/(ImportCountryT1+ExportCountryT1))*100
gen Import_log = ln(ImportT1)
gen Export_log = ln(Export)
drop if ImportincreaseT1T2 ==.
gen importincrease = 1 if ImportincreaseT1T2>=0
replace importincrease = 0 if ImportincreaseT1T2<0
gen importsurge75 = 1 if ImportincreaseT1T2>=75
replace importsurge75 = 0 if ImportincreaseT1T2<75
gen importsurge45 = 1 if ImportincreaseT1T2>=45
replace importsurge45 = 0 if ImportincreaseT1T2<45
gen HomRaw = 1 if RawMaterials==1 & Rauchcon==0
replace HomRaw=0 if RawMaterials==0 | Rauchcon==1
gen Balance =  ExportT1 - ImportT1
gen Balance_Trade = Balance / (ImportT1 + ExportT1)
xtile Comparative = Balance, nq(5)
drop if TariffAHSWAAll==.

heckprobit SelectiveProtection IITt1 GVC importsurge45 ib3.Government PTAs Comparative i.Countryid i.Sector, sel(TradeBarrier=  importincrease ib3.Government TariffAHSWAAll Trade_importance Comparative i.Countryid i.Sector) vce(robust) first

drop if Rauchcon==.

heckprobit SelectiveProtection IITt1 GVC importsurge75 ib3.Government PTAs Comparative i.Countryid i.Sector, sel(TradeBarrier=  importincrease ib3.Government TariffAHSWAAll Trade_importance HomRaw IITt1 GVC Comparative i.Countryid i.Sector) vce(robust) first

heckprobit SelectiveProtection IITt1 GVC importsurge45 ib3.Government PTAs Rauchcon i.Countryid i.Sector, sel(TradeBarrier=  importincrease ib3.Government TariffAHSWAAll Trade_importance Rauchcon i.Countryid i.Sector) vce(robust) first

heckprobit SelectiveProtection IITt1 GVC importsurge75 ib3.Government PTAs Rauchcon i.Countryid i.Sector, sel(TradeBarrier=  importincrease ib3.Government TariffAHSWAAll Trade_importance HomRaw IITt1 GVC Rauchcon i.Countryid i.Sector) vce(robust) first

************************* Robustness  ********************************************

************************* Table 4.5  ********************************************

use "STP Dataset(V2).dta", clear

drop if Year == 2007
gen TradeBarrier = 1 if TradeBarrierCount>0
replace TradeBarrier = 0 if TradeBarrierCount==0
gen Trade_importance = ((ImportT1+ExportT1)/(ImportCountryT1+ExportCountryT1))*100
gen Import_log = ln(ImportT1)
gen Export_log = ln(Export)
drop if ImportincreaseT1T2 ==.
gen importincrease = 1 if ImportincreaseT1T2>=0
replace importincrease = 0 if ImportincreaseT1T2<0
gen importsurge75 = 1 if ImportincreaseT1T2>=75
replace importsurge75 = 0 if ImportincreaseT1T2<75
gen importsurge45 = 1 if ImportincreaseT1T2>=45
replace importsurge45 = 0 if ImportincreaseT1T2<45
gen HomRaw = 1 if RawMaterials==1 & Rauchcon==0
replace HomRaw=0 if RawMaterials==0 | Rauchcon==1
gen choice = 1 if TradeBarrier==0
replace choice = 2 if SelectiveProtection ==1
replace choice = 3 if GeneralProtection ==1
replace choice = 4 if GeneralProtection ==1 & SelectiveProtection ==1
drop if choice==4
drop if TariffAHSWAAll==.

mlogit choice IITt1 GVC importincrease i.Countryid i.Sector, vce(cl Countryid) 

mlogit choice IITt1 GVC  ib3.Government PTAs importincrease  TariffAHSWAAll Trade_importance  i.Countryid i.Sector,  vce(cl Countryid) 

drop if Rauchcon==.

mlogit choice IITt1 GVC importsurge45 ib3.Government PTAs TariffAHSWAAll Trade_importance HomRaw i.Countryid i.Sector, vce(cl Countryid) 

use "STP Dataset(V2).dta", clear

drop if Year == 2007
gen TradeBarrier = 1 if TradeBarrierCount>0
replace TradeBarrier = 0 if TradeBarrierCount==0
gen Trade_importance = ((ImportT1+ExportT1)/(ImportCountryT1+ExportCountryT1))*100
gen Import_log = ln(ImportT1)
gen Export_log = ln(Export)
drop if ImportincreaseT1T2 ==.
gen importincrease = 1 if ImportincreaseT1T2>=0
replace importincrease = 0 if ImportincreaseT1T2<0
gen importsurge75 = 1 if ImportincreaseT1T2>=75
replace importsurge75 = 0 if ImportincreaseT1T2<75
gen importsurge45 = 1 if ImportincreaseT1T2>=45
replace importsurge45 = 0 if ImportincreaseT1T2<45
gen HomRaw = 1 if RawMaterials==1 & Rauchcon==0
replace HomRaw=0 if RawMaterials==0 | Rauchcon==1
gen choice = 1 if TradeBarrier==0
replace choice = 2 if SelectiveProtection ==1
replace choice = 3 if GeneralProtection ==1
replace choice = 4 if GeneralProtection ==1 & SelectiveProtection ==1
drop if choice==4
drop if TariffAHSWAAll==.

* Table A12
mprobit choice IITt1 GVC importincrease i.Countryid i.Sector, vce(cl Countryid) 

mprobit choice IITt1 GVC  ib3.Government PTAs importincrease  TariffAHSWAAll Trade_importance i.Countryid i.Sector,  vce(cl Countryid) 

drop if Rauchcon==.

mprobit choice IITt1 GVC importsurge45 ib3.Government PTAs TariffAHSWAAll Trade_importance HomRaw i.Countryid i.Sector, vce(cl Countryid) 

************************* Table 4.6  ********************************************
use "STP Dataset(V2).dta", clear

***** Binding overhang ******** 
drop if Year == 2007
gen TradeBarrier = 1 if TradeBarrierCount>0
replace TradeBarrier = 0 if TradeBarrierCount==0
gen Trade_importance = ((ImportT1+ExportT1)/(ImportCountryT1+ExportCountryT1))*100
gen Import_log = ln(ImportT1)
gen Export_log = ln(Export)
drop if ImportincreaseT1T2 ==.
gen importincrease = 1 if ImportincreaseT1T2>=0
replace importincrease = 0 if ImportincreaseT1T2<0
gen importsurge75 = 1 if ImportincreaseT1T2>=75
replace importsurge75 = 0 if ImportincreaseT1T2<75
gen importsurge45 = 1 if ImportincreaseT1T2>=45
replace importsurge45 = 0 if ImportincreaseT1T2<45
gen Overhang = 1 if BindingoverhangWAAll>0
replace Overhang = 0 if BindingoverhangWAAll<=0
drop if BindingoverhangWAAll==.

heckprobit SelectiveProtection IITt1 GVC importsurge45  ib3.Government PTAs Overhang i.Countryid i.Sector, sel(TradeBarrier=  importincrease IITt1 GVC ib3.Government TariffAHSWAAll Trade_importance Overhang i.Countryid i.Sector) vce(robust) first

***** Populist era ********
use "STP Dataset(V2).dta", clear

drop if Year == 2007
gen TradeBarrier = 1 if TradeBarrierCount>0
replace TradeBarrier = 0 if TradeBarrierCount==0
gen Trade_importance = ((ImportT1+ExportT1)/(ImportCountryT1+ExportCountryT1))*100
gen Import_log = ln(ImportT1)
gen Export_log = ln(Export)
drop if ImportincreaseT1T2 ==.
gen importincrease = 1 if ImportincreaseT1T2>=0
replace importincrease = 0 if ImportincreaseT1T2<0
gen importsurge75 = 1 if ImportincreaseT1T2>=75
replace importsurge75 = 0 if ImportincreaseT1T2<75
gen importsurge45 = 1 if ImportincreaseT1T2>=45
replace importsurge45 = 0 if ImportincreaseT1T2<45
drop if TariffAHSWAAll==.
gen Populist = 1 if Year>2016
replace Populist = 0 if Year<2017

heckprobit SelectiveProtection IITt1 GVC Populist importsurge45  ib3.Government PTAs  i.Countryid i.Sector, sel(TradeBarrier=  importincrease Populist IITt1 GVC ib3.Government TariffAHSWAAll Trade_importance i.Countryid i.Sector) vce(robust) first

***** China-specific ******** 
use "STP Dataset(V2).dta", clear

drop if Year == 2007
gen TradeBarrier = 1 if TradeBarrierCount>0
replace TradeBarrier = 0 if TradeBarrierCount==0
gen Trade_importance = ((ImportT1+ExportT1)/(ImportCountryT1+ExportCountryT1))*100
gen Import_log = ln(ImportT1)
gen Export_log = ln(Export)
drop if ImportincreaseT1T2 ==.
gen importincrease = 1 if ImportincreaseT1T2>=0
replace importincrease = 0 if ImportincreaseT1T2<0
gen importsurge75 = 1 if ImportincreaseT1T2>=75
replace importsurge75 = 0 if ImportincreaseT1T2<75
gen importsurge45 = 1 if ImportincreaseT1T2>=45
replace importsurge45 = 0 if ImportincreaseT1T2<45
drop if TariffAHSWAAll==.
drop if ChinaSpecific==1

heckprobit SelectiveProtection IITt1 GVC importsurge45  ib3.Government PTAs  i.Countryid i.Sector, sel(TradeBarrier=  importincrease IITt1 GVC ib3.Government TariffAHSWAAll Trade_importance i.Countryid i.Sector) vce(robust) first

***** Contingency ******** 
use "STP Dataset(V2).dta", clear

drop if Year == 2007
gen TradeBarrier = 1 if TradeBarrierCount>0
replace TradeBarrier = 0 if TradeBarrierCount==0
gen Trade_importance = ((ImportT1+ExportT1)/(ImportCountryT1+ExportCountryT1))*100
gen Import_log = ln(ImportT1)
gen Export_log = ln(Export)
drop if ImportincreaseT1T2 ==.
gen importincrease = 1 if ImportincreaseT1T2>=0
replace importincrease = 0 if ImportincreaseT1T2<0
gen importsurge75 = 1 if ImportincreaseT1T2>=75
replace importsurge75 = 0 if ImportincreaseT1T2<75
gen importsurge45 = 1 if ImportincreaseT1T2>=45
replace importsurge45 = 0 if ImportincreaseT1T2<45
drop if TariffAHSWAAll==.

drop if Duration<1826 & Contingency==1

heckprobit SelectiveProtection IITt1 GVC importsurge75  ib3.Government PTAs  i.Countryid i.Sector, sel(TradeBarrier=  importincrease IITt1 GVC ib3.Government TariffAHSWAAll Trade_importance  i.Countryid i.Sector) vce(robust) first

************************* Table A.5 ********************************************

use "STP Dataset(V2).dta", clear

drop if Year == 2007
gen TradeBarrier = 1 if TradeBarrierCount>0
replace TradeBarrier = 0 if TradeBarrierCount==0
gen Trade_importance = ((ImportT1+ExportT1)/(ImportCountryT1+ExportCountryT1))*100
gen Import_log = ln(ImportT1)
gen Export_log = ln(Export)
drop if ImportincreaseT1T2 ==.
gen importincrease = 1 if ImportincreaseT1T2>=0
replace importincrease = 0 if ImportincreaseT1T2<0
gen importsurge75 = 1 if ImportincreaseT1T2>=75
replace importsurge75 = 0 if ImportincreaseT1T2<75
gen importsurge45 = 1 if ImportincreaseT1T2>=45
replace importsurge45 = 0 if ImportincreaseT1T2<45
gen HomRaw = 1 if RawMaterials==1 & Rauchcon==0
replace HomRaw=0 if RawMaterials==0 | Rauchcon==1
drop if TradeBarrier == 0

probit SelectiveProtection IITt1 GVC importincrease i.Countryid i.Sector, vce(robust) 

probit SelectiveProtection IITt1 GVC importsurge45 ib3.Government PTAs importincrease TariffAHSWAAll Trade_importance i.Countryid i.Sector, vce(robust) 

drop if Rauchcon==.

probit SelectiveProtection IITt1 GVC importsurge75 ib3.Government PTAs importincrease TariffAHSWAAll Trade_importance HomRaw i.Countryid i.Sector, vce(robust) 

************************* Table A.6 ********************************************

use "STP Dataset(V2).dta", clear

***** Binding overhang ******** 
drop if Year == 2007
gen TradeBarrier = 1 if TradeBarrierCount>0
replace TradeBarrier = 0 if TradeBarrierCount==0
gen Trade_importance = ((ImportT1+ExportT1)/(ImportCountryT1+ExportCountryT1))*100
gen Import_log = ln(ImportT1)
gen Export_log = ln(Export)
drop if ImportincreaseT1T2 ==.
gen importincrease = 1 if ImportincreaseT1T2>=0
replace importincrease = 0 if ImportincreaseT1T2<0
gen importsurge75 = 1 if ImportincreaseT1T2>=75
replace importsurge75 = 0 if ImportincreaseT1T2<75
gen importsurge45 = 1 if ImportincreaseT1T2>=45
replace importsurge45 = 0 if ImportincreaseT1T2<45
gen HomRaw = 1 if RawMaterials==1 & Rauchcon==0
replace HomRaw=0 if RawMaterials==0 | Rauchcon==1
gen Overhang = 1 if BindingoverhangWAAll>10
replace Overhang = 0 if BindingoverhangWAAll<=10
drop if BindingoverhangWAAll==.
drop if Rauchcon==.

heckprobit SelectiveProtection IITt1 GVC importsurge45  ib3.Government PTAs Overhang i.Countryid i.Sector, sel(TradeBarrier=  importincrease IITt1 GVC ib3.Government TariffAHSWAAll Trade_importance HomRaw Overhang i.Countryid i.Sector) vce(robust) first

************************* Table A.7 ********************************************
***** Trade barrier in previous year ******** 
use "STP Dataset(V2).dta", clear

drop if Year == 2007
gen TradeBarrier = 1 if TradeBarrierCount>0
replace TradeBarrier = 0 if TradeBarrierCount==0
gen Trade_importance = ((ImportT1+ExportT1)/(ImportCountryT1+ExportCountryT1))*100
gen Import_log = ln(ImportT1)
gen Export_log = ln(Export)
drop if ImportincreaseT1T2 ==.
gen importincrease = 1 if ImportincreaseT1T2>=0
replace importincrease = 0 if ImportincreaseT1T2<0
gen importsurge75 = 1 if ImportincreaseT1T2>=75
replace importsurge75 = 0 if ImportincreaseT1T2<75
gen importsurge45 = 1 if ImportincreaseT1T2>=45
replace importsurge45 = 0 if ImportincreaseT1T2<45
gen HomRaw = 1 if RawMaterials==1 & Rauchcon==0
replace HomRaw=0 if RawMaterials==0 | Rauchcon==1
gen TradeBarrierT1 = 1 if BarrierT1>0
replace TradeBarrierT1 = 0 if BarrierT1==0
drop if Year == 2008

heckprobit SelectiveProtection IITt1 GVC TradeBarrierT1 i.Countryid i.Sector, sel(TradeBarrier= importincrease TradeBarrierT1 i.Countryid i.Sector) vce(robust) first

drop if TariffAHSWAAll==.

heckprobit SelectiveProtection IITt1 GVC TradeBarrierT1 importsurge45 ib3.Government PTAs i.Countryid i.Sector, sel(TradeBarrier= importincrease ib3.Government TariffAHSWAAll Trade_importance TradeBarrierT1 i.Countryid i.Sector) vce(robust) first

drop if Rauchcon==.

heckprobit SelectiveProtection IITt1 GVC importsurge75 TradeBarrierT1 ib3.Government PTAs  i.Countryid i.Sector, sel(TradeBarrier=  importincrease IITt1 GVC ib3.Government TariffAHSWAAll Trade_importance HomRaw TradeBarrierT1 i.Countryid i.Sector) vce(robust) first

************************* Table A.8 ********************************************
***** Time dummies ******** 
use "STP Dataset(V2).dta", clear

drop if Year == 2007
gen TradeBarrier = 1 if TradeBarrierCount>0
replace TradeBarrier = 0 if TradeBarrierCount==0
gen Trade_importance = ((ImportT1+ExportT1)/(ImportCountryT1+ExportCountryT1))*100
gen Import_log = ln(ImportT1)
gen Export_log = ln(Export)
drop if ImportincreaseT1T2 ==.
gen importincrease = 1 if ImportincreaseT1T2>=0
replace importincrease = 0 if ImportincreaseT1T2<0
gen importsurge75 = 1 if ImportincreaseT1T2>=75
replace importsurge75 = 0 if ImportincreaseT1T2<75
gen importsurge45 = 1 if ImportincreaseT1T2>=45
replace importsurge45 = 0 if ImportincreaseT1T2<45
gen HomRaw = 1 if RawMaterials==1 & Rauchcon==0
replace HomRaw=0 if RawMaterials==0 | Rauchcon==1

heckprobit SelectiveProtection IITt1 GVC i.Countryid i.Sector i.Year, sel(TradeBarrier= importincrease i.Countryid i.Sector i.Year) vce(robust) first

drop if TariffAHSWAAll==.

heckprobit SelectiveProtection IITt1 GVC importsurge45 ib3.Government PTAs i.Countryid i.Sector i.Year, sel(TradeBarrier= importincrease ib3.Government TariffAHSWAAll Trade_importance i.Countryid i.Sector i.Year) vce(robust) first

drop if Rauchcon==.

heckprobit SelectiveProtection IITt1 GVC importsurge75  ib3.Government PTAs  i.Countryid i.Sector i.Year, sel(TradeBarrier=  importincrease IITt1 GVC ib3.Government TariffAHSWAAll Trade_importance HomRaw i.Countryid i.Sector i.Year) vce(robust) first

************************* Table A.9 ********************************************
***** AD & CVD ******** 
use "STP Dataset(V2).dta", clear

drop if Year == 2007
gen TradeBarrier = 1 if TradeBarrierCount>0
replace TradeBarrier = 0 if TradeBarrierCount==0
gen Trade_importance = ((ImportT1+ExportT1)/(ImportCountryT1+ExportCountryT1))*100
gen Import_log = ln(ImportT1)
gen Export_log = ln(Export)
drop if ImportincreaseT1T2 ==.
gen importincrease = 1 if ImportincreaseT1T2>=0
replace importincrease = 0 if ImportincreaseT1T2<0
gen importsurge75 = 1 if ImportincreaseT1T2>=75
replace importsurge75 = 0 if ImportincreaseT1T2<75
gen importsurge45 = 1 if ImportincreaseT1T2>=45
replace importsurge45 = 0 if ImportincreaseT1T2<45

heckprobit ADCVD IITt1 GVC i.Countryid i.Sector, sel(TradeBarrier= importincrease i.Countryid i.Sector) vce(robust) first

drop if TariffAHSWAAll==.

heckprobit ADCVD IITt1 GVC importsurge45 ib3.Government PTAs i.Countryid i.Sector, sel(TradeBarrier= importincrease ib3.Government TariffAHSWAAll Trade_importance i.Countryid i.Sector) vce(robust) first

heckprobit ADCVD IITt1 GVC importsurge75  ib3.Government PTAs  i.Countryid i.Sector, sel(TradeBarrier=  importincrease IITt1 GVC ib3.Government TariffAHSWAAll Trade_importance i.Countryid i.Sector) vce(robust) first

************************* Table A.10 ********************************************

************************* SUR  ********************************************

use "STP Dataset(V2).dta", clear

drop if Year == 2007
gen TradeBarrier = 1 if TradeBarrierCount>0
replace TradeBarrier = 0 if TradeBarrierCount==0
gen Trade_importance = ((ImportT1+ExportT1)/(ImportCountryT1+ExportCountryT1))*100
gen Import_log = ln(ImportT1)
gen Export_log = ln(Export)
drop if ImportincreaseT1T2 ==.
gen importincrease = 1 if ImportincreaseT1T2>=0
replace importincrease = 0 if ImportincreaseT1T2<0
gen importsurge75 = 1 if ImportincreaseT1T2>=75
replace importsurge75 = 0 if ImportincreaseT1T2<75
gen importsurge45 = 1 if ImportincreaseT1T2>=45
replace importsurge45 = 0 if ImportincreaseT1T2<45
gen HomRaw = 1 if RawMaterials==1 & Rauchcon==0
replace HomRaw=0 if RawMaterials==0 | Rauchcon==1
drop if TariffAHSWAAll==.

biprobit (SelectiveProtection IITt1 GVC i.Countryid i.Sector)(TradeBarrier importincrease  i.Countryid i.Sector), vce(robust)

biprobit (SelectiveProtection IITt1 GVC importsurge45 ib3.Government PTAs i.Countryid i.Sector)(TradeBarrier importincrease ib3.Government TariffAHSWAAll Trade_importance  i.Countryid i.Sector), vce(robust)

drop if Rauchcon==.

biprobit (SelectiveProtection IITt1 GVC importsurge75 ib3.Government PTAs i.Countryid i.Sector)(TradeBarrier importincrease ib3.Government TariffAHSWAAll Trade_importance HomRaw IITt1 GVC i.Countryid i.Sector), vce(robust)

************************* Table A.11 ********************************************
************************* Interaction  ********************************************
use "STP Dataset(V2).dta", clear

drop if Year == 2007
gen TradeBarrier = 1 if TradeBarrierCount>0
replace TradeBarrier = 0 if TradeBarrierCount==0
gen Trade_importance = ((ImportT1+ExportT1)/(ImportCountryT1+ExportCountryT1))*100
gen Import_log = ln(ImportT1)
gen Export_log = ln(Export)
drop if ImportincreaseT1T2 ==.
gen importincrease = 1 if ImportincreaseT1T2>=0
replace importincrease = 0 if ImportincreaseT1T2<0
gen importsurge75 = 1 if ImportincreaseT1T2>=75
replace importsurge75 = 0 if ImportincreaseT1T2<75
gen importsurge45 = 1 if ImportincreaseT1T2>=45
replace importsurge45 = 0 if ImportincreaseT1T2<45
gen HomRaw = 1 if RawMaterials==1 & Rauchcon==0
replace HomRaw=0 if RawMaterials==0 | Rauchcon==1
gen IIT_GVC = IITt1 * GVC
drop if TariffAHSWAAll==.

heckprobit SelectiveProtection IITt1 GVC IIT_GVC i.Countryid i.Sector, sel(TradeBarrier= importincrease i.Countryid i.Sector) vce(robust) first

heckprobit SelectiveProtection IITt1 GVC IIT_GVC importsurge45 ib3.Government PTAs i.Countryid i.Sector, sel(TradeBarrier= importincrease ib3.Government TariffAHSWAAll Trade_importance i.Countryid i.Sector) vce(robust) first

drop if Rauchcon==.

heckprobit SelectiveProtection IITt1 GVC IIT_GVC importsurge75 ib3.Government PTAs  i.Countryid i.Sector, sel(TradeBarrier=  importincrease IITt1 GVC ib3.Government TariffAHSWAAll HomRaw Trade_importance i.Countryid i.Sector) vce(robust) first

************************* Table A.13 ********************************************
* IIT ordinal 

use "STP Dataset(V2).dta", clear

drop if Year == 2007
gen TradeBarrier = 1 if TradeBarrierCount>0
replace TradeBarrier = 0 if TradeBarrierCount==0
gen Trade_importance = ((ImportT1+ExportT1)/(ImportCountryT1+ExportCountryT1))*100
gen Import_log = ln(ImportT1)
gen Export_log = ln(Export)
drop if ImportincreaseT1T2 ==.
gen importincrease = 1 if ImportincreaseT1T2>=0
replace importincrease = 0 if ImportincreaseT1T2<0
gen importsurge75 = 1 if ImportincreaseT1T2>=75
replace importsurge75 = 0 if ImportincreaseT1T2<75
gen importsurge45 = 1 if ImportincreaseT1T2>=45
replace importsurge45 = 0 if ImportincreaseT1T2<45
gen HomRaw = 1 if RawMaterials==1 & Rauchcon==0
replace HomRaw=0 if RawMaterials==0 | Rauchcon==1
xtile IIT_5 = IITt1, nq(5)

heckprobit SelectiveProtection IIT_5 GVC i.Countryid i.Sector, sel(TradeBarrier= importincrease i.Countryid i.Sector) vce(robust) first

drop if TariffAHSWAAll==.

heckprobit SelectiveProtection IIT_5 GVC importsurge45 ib3.Government PTAs i.Countryid i.Sector, sel(TradeBarrier= importincrease ib3.Government TariffAHSWAAll Trade_importance i.Countryid i.Sector) vce(robust) first

drop if Rauchcon==.

heckprobit SelectiveProtection IIT_5 GVC  importsurge75 ib3.Government PTAs  i.Countryid i.Sector, sel(TradeBarrier=  importincrease IIT_5 GVC ib3.Government TariffAHSWAAll Trade_importance HomRaw i.Countryid i.Sector) vce(robust) first